<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
      @keyframes shake {
        0% {
          transform: translateX(0);
        }
        50% {
          transform: translateX(50px);
        }
        100% {
          transform: translateX(0);
        }
      }

      .box {
        width: 100px;
        height: 200px;
        background-color: bisque;
        display: flex;
        justify-content: center;
        align-items: center;
      }

      .animation{
        animation:shake 2s infinite alternate;
      }
    </style>

  </head>
  <body>
    <div id="app">
      
    </div>

    <script src="../js/vue.js"></script>

    <script>
      const app = Vue.createApp({
        data() {
          return {
            isAnimation: false
          }
        },
        methods:{
          deal(){
            return this.isAnimation = !this.isAnimation;
          }
        },
        template:`
        <div >
          <div class="box" :class="{animation:isAnimation}">2021年8月20日09:49:19</div>
          <button @click="deal">开始/结束</button>
        </div>
        `
      }).mount("#app");
    </script>
  </body>
</html>